package model;

import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;


public class WriteBinaryData {
	public static void main(String[] args) throws IOException{
	
		int iVal = 25678;
		double dVal = -67.76;
		boolean bVal = true;
		String strVal = "It's ok!";
		float fVal = 23.4f;
		
		DataOutputStream dos;
		
		try {
			FileOutputStream fos = new FileOutputStream("a.dat");
			
			dos = new DataOutputStream(fos);
		}
		catch (Exception e) {
			System.out.println("Error create file.");
			return;
		}
		
		try {
			dos.writeInt(iVal);
			dos.writeDouble(dVal);
			dos.writeBoolean(bVal);
			dos.writeFloat(fVal);
			dos.writeUTF("ủn ỉn");
		}
		catch (Exception e) {
			System.out.println("Error write file.");
		}
		dos.close();
	}

}
